#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
//约瑟夫环问题
int main()
{
	int m = 0;
	scanf("%d", &m);
	getchar();
	char arr[100] = { 0 };
	char ch;
	int i = 0;
	while ((ch = getchar()) != '\n')
	{
		if (ch != ',')
		{
			arr[i] = ch;
			i++;
		}
	}
	int n = i;//总人数
	int len = i;//长度
	int count = 0;
	int j = 0;
	while (n != 0)
	{
		if (arr[j] != 0)
			count++;
		if (count == m && arr[j] != 0)
		{
			count = 0;
			if (n != 1)
				printf("%c,", arr[j]);
			else
				printf("%c", arr[j]);
			arr[j] = 0;
			n--;//人数减一
		}
		j++;
		if (j == len)
			j = 0;
	}
	return 0;
}
